
	
	
	
use RFS_master_data, clear
 
	 cap drop sizeC LsizeC
	bys call : egen sizeC = mean(quantity)
	gen LsizeC = log(sizeC)
 
 bys call:  gen FauxC = _n
  *************SCATTER SCATTER:
  ************************************************************
    * OPTION 1: AVERAGE TRADE SIZE
 cap drop yy xx
 gen yy = ave_C_N_aver  if FauxC == 1 // y5_ave Adspread Adyear10
  gen xx = LsizeC if FauxC == 1 //  LsizeC Lcall_vol Lcall_size
	  winsor2 yy, replace cuts(1 99) trim 
	  winsor2 xx, replace cuts(1 99) trim 

   reg yy xx   , vce(robust)  //  D_usim   D_umul     Run the regression quietly, where quietly is optional
loc r2A : di %3.2f e(r2)   //Get the R-square with two decimal multiplied by 100
 
 tw  (scatter yy xx) (lfit yy xx)     ,    legend(off)  ///
ytitle("Average Trading Cost", size(large)) graphregion(color(white))  xtitle("Average Trade Size", size(large)) ///
  name("ff2",replace)  
  
  graph export "Scatter_Cross_2022_Basline.pdf", replace

   